Repository navigation
[None][test] Cut the pre-merge CI time of the indexer Top-K unit tests - #23155
longcheng-nv wants to merge 2 commits into
Conversation
test_indexer_topk.py and test_gvr_selfsampling_topk.py cost 689 GPU-weighted
hours of pre-merge test time in the week of 2026-11-09. Keep pre-merge on the
cases that guard production paths and run the rest of each grid post-merge:
- tests/unittest/conftest.py marks the parametrized cases outside a module's
PRE_MERGE_CELLS with post_merge, and test_unittests.py leaves post_merge
cases out of every CI stage whose name lacks "Post-Merge".
- Both files declare PRE_MERGE_CELLS: production paths (fp32 scores, K in
{512, 1024, 2048}) keep covering cells; entry points and dtypes without a
production caller keep smoke cells.
- The l0_gb300.yml pre-merge kernels/parallel entry ignores both files (B300
runs the same SM103 kernels); l0_b200.yml post-merge runs their post_merge
cases.
- The per-row oracles of test_gvr_selfsampling_topk.py become batched tensor
checks with the same assertions.
Signed-off-by: longcheng-nv <243710427+longcheng-nv@users.noreply.github.com>
|
/bot run --extra-stage "DGX_B200-PyTorch-Post-Merge-1,DGX_B200-PyTorch-Post-Merge-2" |
|
PR_Github #88457 [ run ] triggered by Bot. Commit: |
|
PR_Github #88457 [ run ] completed with state
|
|
No actionable comments were generated in the recent review. WalkthroughThe change adds parameter-based pre-merge selection for Top-K tests, marks other cases for post-merge runs, updates integration-stage test lists, and replaces several per-row GVR self-sampling checks with batched tensor validation. ChangesTop-K test selection and validation
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Other Sequence Diagram(s)sequenceDiagram
participant IntegrationStage
participant test_unittests_v2
participant pytest
participant pytest_collection_modifyitems
IntegrationStage->>test_unittests_v2: supplies stage prefix and mark expression
test_unittests_v2->>pytest: passes the stage-filtered mark expression
pytest->>pytest_collection_modifyitems: collects parametrized test items
pytest_collection_modifyitems->>pytest: marks unselected cases post_merge
Suggested reviewers: Merge Risk:
|
|
@heyuhhh, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~ Assignment explanation
Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once. |
|
Thanks for the PR, @longcheng-nv. @trtllm-agent-review reviews it when it is asked to: once the PR is ready for review, please comment |
test_gvr_selfsampling_topk.py runs in full on SM90: main's H100 pre-merge stage passes 1,012 of its 1,013 cases. With PRE_MERGE_CELLS, H100 pre-merge keeps 269 of them, and no H100 post-merge list ran the file, so the other 744 cases stopped running on SM90. Add the file's post_merge cases to the l0_h100.yml post-merge block, with an agg_unit_mem_df.csv row that uses the parallel factor of the kernels/parallel row. test_indexer_topk.py needs no entry: its cases outside the cells skip on SM90. Signed-off-by: longcheng-nv <243710427+longcheng-nv@users.noreply.github.com>
|
/bot run --extra-stage "DGX_B200-PyTorch-Post-Merge-1,DGX_B200-PyTorch-Post-Merge-2,DGX_H100-PyTorch-Post-Merge-1,DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #88629 [ run ] triggered by Bot. Commit: |
|
PR_Github #88629 [ run ] completed with state
|
| batch_size=1, next_n=1, index_topk=2048, num_tokens=131072, dtype=_F16, cluster_size=4 | ||
| ), | ||
| ], | ||
| "test_cute_dsl_topk_decode_high_and_odd_k": [ |
There was a problem hiding this comment.
No pre-merge cell runs top_k=16384. These four cells stop at K=8192, so the regression check inside test_cute_dsl_topk_decode_high_and_odd_k (the batch_size == 1 and index_topk == 16384 and num_tokens == 32768 branch, around line 988) no longer runs pre-merge. That branch is the one that checks a row whose effective length spans more than one chunk but is at most top_k, in a 4-CTA radix-filter cluster.
This is a production path: TriAttention allows budgets up to 16384 (triattention.py:124, "must be at most 16384 for the Blackwell TopK selector") and selects with TopKImplementation.CUTE_DSL_RADIX. A change that breaks that case would pass every pre-merge stage and only show up post-merge.
Suggested: add dict(batch_size=1, index_topk=16384, num_tokens=32768) to this function's cells.
| dict(overflow_policy="REREAD", batch_size=4, top_k=512, dtype=_F32), | ||
| ], | ||
| # The prefill kernel uses every overflow policy: each one in fp32, plus a bf16 cell | ||
| "test_prefill_overflow_policy_overflow": [ |
There was a problem hiding this comment.
fp32 REREAD is pre-merge only at K=2048. cute_dsl_indexer_topk_prefill_blackwell defaults to overflow_policy="REREAD", and the production callers don't pass a policy. With these cells, K=512 runs only GMEM_SPILL (fp32) and REREAD in bf16, and K=1024 only TRUNCATE. The other CuTe DSL prefill tests stop at num_tokens=8192, the fp32 SMEM input size, so they never reach the reread fallback either.
That fallback at K=512 is the path CSA2's prefill (index_topk 512) takes on long context chunks with more than 8192 columns, so a regression there would pass pre-merge. The comment above ("The prefill kernel uses every overflow policy") also reads as if each K were covered.
Suggested: add fp32 REREAD cells for top_k 512 and 1024 (or move REREAD onto those K), and reword the comment to say which K each policy runs at.
|
@kris1025, thanks for picking up this PR! I’ve handed off the trt-llm-torch-attention-devs review from @heyuhhh to you. @heyuhhh’s unfinished attention reservation has been released. @kris1025’s review is assessed at 5 points. Any completed review credit from earlier rounds is preserved. Each reviewer’s work is counted once per review round. @heyuhhh, no further attention review is requested from you. Thanks~ |
|
/bot run --extra-stage "DGX_B200-PyTorch-Post-Merge-1,DGX_B200-PyTorch-Post-Merge-2,DGX_H100-PyTorch-Post-Merge-1,DGX_H100-PyTorch-Post-Merge-2" |
|
PR_Github #88932 [ run ] triggered by Bot. Commit: |
|
PR_Github #88932 [ run ] completed with state |
Dev Engineer Review
tests/unittest/conftest.pymarks cases outsidePRE_MERGE_CELLSaspost_mergebefore pytest selection. Unconfigured modules and non-parametrized items stay selected. Confirm that a parameter rename does not silently drop cases from the pre-merge selection._stage_unittest_markexprintests/integration/defs/test_unittests.pyappendsnot post_mergeto stages whose names lack "Post-Merge". Confirm that existing mark expressions keep their meaning when combined withnot post_merge._check_prefill_exactskips score-selection checks on rows with in-window NaNs and checks only structure on those rows. This weakens the oracle for those rows.l0_gb300.ymlremoves both files from the pre-merge parallel-kernel entry. Their full grids run only post-merge on GB300.ci: full pre-merge approvedlabel gate. No completed post-merge result is established from the supplied evidence.QA Engineer Review
tests/unittest/_torch/kernels/parallel/test_gvr_selfsampling_topk.py: addsPRE_MERGE_CELLS,_fp32_and, and batched checks.tests/unittest/_torch/kernels/parallel/test_indexer_topk.py: addsPRE_MERGE_CELLS.tests/unittest/tools/test_unittest_culprits.py: addstest_stage_unittest_markexpr_keeps_post_merge_tests_out_of_pre_merge_stages, parameterized over mark expressions and stage names.l0_b200.yml: adds both files with-m post_mergeand a 90-minute timeout.l0_h100.yml: adds the GVR file withpost_mergeselection and a 90-minute timeout.l0_gb300.yml: removes both files from the parallel-kernel entry.Per-File QA Perspective
tests/integration/defs/test_unittests.py: verify that stages without "Post-Merge" in their names run nopost_mergetests.tests/integration/test_lists/test-db/l0_b200.yml: verify that both files run in the post-merge B200 stages.tests/integration/test_lists/test-db/l0_h100.yml: verify that GVRpost_mergecases run on SM90.tests/integration/test_lists/test-db/l0_gb300.yml: verify that GB300 pre-merge no longer runs these files.tests/unittest/_torch/kernels/parallel/test_gvr_selfsampling_topk.py: verify that batched checks still detect wrong indices and values.tests/unittest/_torch/kernels/parallel/test_indexer_topk.py: verify that pre-merge cells cover the listed fp32 K values.tests/unittest/conftest.py: verify thatpost_mergemarking applies only to configured modules.tests/unittest/tools/test_unittest_culprits.py: run the new parameterized test with its listed inputs.Description
tests/unittest/_torch/kernels/parallel/test_indexer_topk.pyandtest_gvr_selfsampling_topk.pyare in the top 1% of pre-merge test time: in the week of 2026-11-09 they cost 377.5 and 312.0 GPU-weighted hours (L0_MergeRequest, test-case durations weighted by the GPU count of the stage), 1.41% of all pre-merge test time. This PR keeps pre-merge on the cases that guard production paths and runs every other case of each grid post-merge. No case is deleted.Where the time went:
cute_dsl_topk_decode_blackwell,cute_dsl_topk_decode_multi_cta_blackwell) and the single-pass mode-2 runners alone took 39% oftest_indexer_topk.py.test_gvr_selfsampling_topk.py.Changes:
Pre-merge cells, full grids post-merge. A test module may declare
PRE_MERGE_CELLS, a dict from a test function to the parameter cells pre-merge keeps (or a predicate).tests/unittest/conftest.pymarks every other parametrized case of those functionspost_merge(already registered intests/unittest/pytest.ini).tests/integration/defs/test_unittests.pyappendsand not post_mergeto the unittest mark expression of every stage whose name lacksPost-Merge(the rulegetMakoArgsFromStageNameuses). Test-list entry text, theagg_unit_mem_df.csvworker lookup and waives are unchanged.Cells anchored on production paths. The model paths pass fp32 scores. Callers of these ops and their K:
enable_heuristic_topkon SM100/103, CuTe DSL radix withuse_cute_dsl_topk.The kept cells cover each K in {512, 1024, 2048}, compress ratio 1 and 4, every N bucket the grids test (up to 262,144 columns), rows on both sides of the SM count, next_n > 1, the deterministic and MTP variants, and the gate and routing edges; data patterns rotate across shapes instead of crossing them. Entry points without a production caller, odd or above-2048 K, decode overflow policies other than REREAD, and the bf16/fp16 score paths keep one to four smoke cells each. The CUDA
indexer_topk_decode/indexer_topk_prefillgrids (0.07 s per case) stay whole.GB300 pre-merge drops the two files.
l0_gb300.ymladds--ignorefor both to itskernels/parallelentry (--ignoredoes not change the CSV key). The full grids keep running post-merge on SM103 (GB300,l0_gb300_multi_gpus.yml) and SM100 (two new-m post_mergeentries inl0_b200.yml, with 8-worker rows inagg_unit_mem_df.csv); GR100 (SM107,l0_gr100.yml) post-merge keeps running the fulltest_gvr_selfsampling_topk.py, as before.Vectorized GVR oracles.
_check_prefill_exact,_check_exact,_check_wide,_run_varlen_case(now_check_varlen_rows),_reference_varlen_indicesand the poison loop of_make_prefill_casekeep their assertions as batched tensor checks with one sync each.SM90 post-merge entry for the GVR file. main's H100 pre-merge stage runs all of
test_gvr_selfsampling_topk.py(1,012 of 1,013 cases pass on SM90). H100 pre-merge now keeps the 269 cells, so thel0_h100.ymlpost-merge block gets a-m post_mergeentry for the other 744, with an 8-worker row inagg_unit_mem_df.csv.test_indexer_topk.pyneeds none: its cases outside the cells skip on SM90.Pre-merge per stage:
test_indexer_topk.py1,396 -> 318 cases,test_gvr_selfsampling_topk.py1,013 -> 269 cases. Deliberately dropped from pre-merge (still post-merge): crosses of data patterns with shapes, extra batch sizes and N values inside one dispatch class, the full grids of the non-production entry points and dtypes.Test Coverage
CI. The first CI run of this branch (L0_MergeRequest_PR #73458 on 2ab28fe) passed every CPU and single-GPU stage with 0 failed tests (164,978 passed, 15,810 skipped). It shows UNSTABLE only because the multi-GPU stages, GB300 included, wait for the
ci: full pre-merge approvedlabel. Test time of the two files per stage run, main -> this PR, where main is the median of its pre-merge runs from 2026-11-24 to 2026-12-01 (about 570 to 600 runs per single-GPU stage, 152 on GB300):test_indexer_topk.pytest_gvr_selfsampling_topk.pyDGX_B200-PyTorch-Post-Merge-1/-2) ran all 1,822 post-merge cases (1,078 + 744), all passed, in about 2.5 minutes of wall time per entry.Lab reproduction on one B200 with the main post-merge wheel of d29d9b9 (
tensorrt_llm1.4.0rc5) plus this branch's tests and the GVR host modules from main, CI flags (-n 8,--timeout=2400), a fresh CuTe DSL cache per run:test_indexer_topk.pytest_gvr_selfsampling_topk.pyMedians of 3 baseline runs and 2 runs of this branch on the same GPU, run alternately.
-m post_merge, 1,822 cases) passed in both runs.tests/unittest/tools/test_unittest_culprits.py(cpu_only): 23 passed, including the new_stage_unittest_markexprcases.PRE_MERGE_CELLSentry names a collected test and every cell matches at least one case.CI:
/bot run --extra-stage "DGX_B200-PyTorch-Post-Merge-1,DGX_B200-PyTorch-Post-Merge-2,DGX_H100-PyTorch-Post-Merge-1,DGX_H100-PyTorch-Post-Merge-2"runs the default pre-merge set plus the post-merge stages that hold the new entries. The multi-GPU stages run once the approval label is on.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.🤖 Generated with Claude Code